# -*- coding: utf-8 -*-
'''
@文件    :user.py
@说明    :
@时间    :2025/08/28 15:30:00
@作者    :浪晋
@版本    :1.0
'''

from pydantic import Field, BaseModel
from typing import Optional, Union, Any, List, Dict
from decimal import Decimal
from datetime import date, datetime
from app.schemas.base import BaseQuerySchema


class BaseSchema(BaseModel):
    account: Union[str, None] = Field(..., description="账号")
    realname: Union[str, None] = Field(..., description="姓名")
    nickname: Union[str, None] = Field(..., description="昵称")
    avatar: Union[str, None] = Field(None, description="头像")
    email: str = Field(None, description="邮箱")
    phone: Union[str, None] = Field(..., description="电话")
    permission: int = Field(None, description="数据权限")
    active: Union[bool, None] = Field(False, description="是否激活")
    last_login_time: datetime = Field(None, description="最后登录时间")
    last_login_ip: str = Field(None, description="最后登录Ip")
    dept: int = Field(..., description="部门")
    roles: List[int] = Field(..., description="角色ID")


class QuerySchema(BaseQuerySchema):
    account: Optional[Union[str, None]] = Field(None, description="账号")
    realname: Optional[Union[str, None]] = Field(None, description="姓名")
    nickname: Optional[Union[str, None]] = Field(None, description="昵称")
    email: Optional[str] = Field(None, description="邮箱")
    phone: Optional[Union[str, None]] = Field(None, description="电话")
    active: Optional[Union[bool, None]] = Field(None, description="是否激活")
    dept_id: Optional[int] = Field(None, description="部门")


class CreateSchema(BaseSchema):
    password: Union[str, None] = Field(..., description="密码")

class UpdateSchema(BaseSchema):
    id: int = Field(..., description="主键Id", example="1")